<?php
namespace member\service;
use herosphp\core\Loader;
use herosphp\bean\Beans;


class RegisterService{

	private $__memberService;

	public function __construct()
	{
		
		$this->__memberService = Beans::get('member.member.service'); 


	}
			
	/*
	 * 判断用户是否已注册
	 */
	public function hasRegister($username)
	{
		if($this->__memberService->count(array('username' => $username,'del_status'=>0)))
		{
			return true;	
		}
		return false;
		
	}
	
	/*
	* 用户注册
	 */
	public function register($data)
	{
	    //先干掉原有的被删除的会员
	    $this -> __memberService -> deletes(array('username'=>$data['username'],'del_status'=>1));
		return $this->__memberService->add($data);
	}

}
